﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;


namespace Out2Share
{
    public class ConfData
    {
        public Dictionary<string, string> ht = new Dictionary<string, string>();

        public string Serialize() {
            return "CONFIGURATION_ENDPOINT_NAME=" + ht["CONFIGURATION_ENDPOINT_NAME"] +
                    ";CONFIGURATION_LIBRARY=" + ht["CONFIGURATION_LIBRARY"] +
                    ";CONFIGURATION_USER_NAME=" + ht["CONFIGURATION_USER_NAME"] +
                    ";CONFIGURATION_USER_PWD=" + ht["CONFIGURATION_USER_PWD"] +
                    ";CONFIGURATION_AUTH=" + ht["CONFIGURATION_AUTH"] +
                    ";CONFIGURATION_PROXY_SET=" + ht["CONFIGURATION_PROXY_SET"] +
                    ";CONFIGURATION_PROXY_ADDRESS=" + ht["CONFIGURATION_PROXY_ADDRESS"] +
                    ";CONFIGURATION_PROXY_USER=" + ht["CONFIGURATION_PROXY_USER"] +
                    ";CONFIGURATION_PROXY_PWD=" + ht["CONFIGURATION_PROXY_PWD"]+
                    ";CONFIGURATION_CATEGORY=" + ht["CONFIGURATION_CATEGORY"]+
                    ";CONFIGURATION_FLAG=" + ht["CONFIGURATION_FLAG"]
                    ;
        }

        public ConfData(string ser) {
            string[] split = ser.Split(';');
            foreach(string pair in split){
                string[] nameValue = pair.Split('=');
                if (nameValue.Length == 2)
                {
                    ht.Add(nameValue[0], nameValue[1]);
                }
            }
        }
    }
}
